<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router'

// 使用 useRouter 创建一个 router 实例
const router = useRouter()
// 搜索框
const value = ref('');
// 宫格{
const gird = [
    { id: 1, text: '玫瑰', image: '/public/index01.png' },
    { id: 2, text: '康乃馨', image: '/public/index02.png' },
    { id: 3, text: '百合', image: '/public/index03.png' },
    { id: 4, text: '菊花', image: '/public/index04.png' },
    { id: 5, text: '绣球花', image: '/public/index05.png' },
    { id: 6, text: '洋桔梗', image: '/public/index06.png' },
    { id: 7, text: '草花', image: '/public/index07.png' },
    { id: 8, text: '配花', image: '/public/index08.png' },
    { id: 9, text: '配叶', image: '/public/index09.png' },
    { id: 10, text: '自选大厅', image: '/public/index10.png',path:'/hall' }
]
// 热销
const selling = [
    { id: 1, text: '热销榜单', text1: '热销9.8万束', image: '/public/index-hua3.png', image1: '/public/index-huo.png' },
    { id: 2, text: '特价专区', text1: '韩式系列', image: '/public/index-hua4.png', image1: '/public/index-biao.png' },
    { id: 3, text: '新品来袭', text1: '小公主', image: '/public/index-hua5.png', image1: '/public/index-new.png' }
]
// 页面跳转
const goPage = (e) => {
    router.push(e)
    // console.log(e);
}
</script>
<template>
    <div class="index">
        <!-- 头部 -->
        <van-nav-bar title="Flower Buy" />
        <!-- 输入框 -->
        <div class="box-input">
            <div style="width: 100%;">
                <van-search shape="round" v-model="value" placeholder="请输入关键词..." />
            </div>
            <van-icon name="service-o" size="28" />

        </div>
        <!-- 轮播图 -->
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
            <van-swipe-item v-for="image in 3">
                <img alt="image" src="../assets/index-banner.png">
            </van-swipe-item>
        </van-swipe>
        <!-- 宫格 -->
        <van-grid :border="false" :column-num="5">
            <van-grid-item v-for="(item, index) in gird" :key="item.id" @click="goPage(item.path)">
                <van-image :src="item.image" />
                <text style=" font-size: 14px;"> {{ item.text }}
                </text> 
            </van-grid-item>
        </van-grid>
        <!-- 官方动态 -->
        <div class="dynamics">
            <div class="dynamics-left">
                官方动态
            </div>
            <div class="dynamics-center"></div>
            <div class="dynamics-right">
                <div class="right-all">
                    <div class="right-one">资讯</div>
                    <div class="right-two">【版本更新】Flower Buy官网更新公告</div>
                </div>
                <div class="right-all">
                    <div class="right-one">动态</div>
                    <div class="right-two">【招商加盟】鲜花店饿了么外卖品牌加盟...</div>
                </div>
            </div>
        </div>
        <!-- 推荐 -->
        <div class="recommend">
            <div class="recommed-left" style="background: repeating-linear-gradient(to left, #fe8d8d, #f8adad);">
                <div class="left-one">
                    <div class="left-one1" style="font-size: 20px;">经典推荐</div>
                    <div class="left-one1">RECOMMENDED
                        CLASSIC</div>
                </div>
                <div class="left-two"><img src="../assets/index-hua1.png" alt=""></div>
            </div>
            <div class="recommed-left" style="background: repeating-linear-gradient(to left, #fe993e, #f8c190);">
                <div class="left-one">
                    <div class="left-one1" style="font-size: 20px;">经典推荐</div>
                    <div class="left-one1">RECOMMENDED
                        CLASSIC</div>
                </div>
                <div class="left-two"><img src="../assets/index-hua2.png" alt=""></div>
            </div>
        </div>
        <!-- 热销 -->
        <div class="sellwell">
            <div class="sellwell-all" v-for="item in selling" :key="item.id">
                <div class="one">
                    <img :src="item.image1" alt="">
                    <div class="color">{{ item.text }}</div>
                </div>
                <div class="two">{{ item.text1 }}</div>
                <div class="three">
                    <img :src="item.image" alt="">
                </div>
            </div>
        </div>
        <!-- 送花 -->
        <div class="sendflowers">
            <div class="left">
                <div>送恋人</div>
                <div>SEND LOVER</div>
                <div>开启你的甜蜜日记<van-icon name="play" size="10px" /></div>
                <img src="/public/index-11.png" alt="">
            </div>
            <div class="right">
                <div class="right-top">
                    <div class="top-left">
                        <div>送长辈</div>
                        <div>SEND ELDER</div>
                        <div>脉脉温意情相伴<van-icon name="play" size="10px" /></div>
                    </div>
                    <div class="top-right">
                        <img src="/public/index-12.png" alt="">
                    </div>
                </div>
                <div class="right-top">
                    <div class="top-left">
                        <div>送朋友</div>
                        <div>SEND FRIEND</div>
                        <div>许久相遇如初见<van-icon name="play" size="10px" /></div>
                    </div>
                    <div class="top-right">
                        <img src="/public/index-13.png" alt="">
                    </div>
                </div>
                <div class="right-bottom"></div>
            </div>
        </div>
        <!-- 爆款 -->
        <div class="explosion">
            <div class="explosion-top">
                <div class="left">爆款必备</div>
                <div class="right">更多<van-icon name="arrow" /></div>
            </div>
            <div class="explosion-bottom">
                <div class="left" v-for="item in 6" :key="item">
                    <img src="/public/index-hua6.png" alt="">
                    <div class="one">春日特辑</div>
                    <div class="two">
                        <div>5.2K/1.0w人已抢</div>
                        <div>52.5%</div>
                    </div>
                    <div class="three">
                        <van-progress :percentage="50" pivot-text=" " stroke-width="8" color="#f84c55" />
                        <img src="/public/fire.png" alt="">
                        <div>剩余10k件</div>
                    </div>
                    <div class="four">
                        <div>￥558.0</div>
                        <div>去抢购</div>

                    </div>
                </div>
                <div class="right"></div>
            </div>
        </div>
        <!-- 盒子 -->
        <div style="height: 200px;"></div>
    </div>
</template>

<style lang="scss">
.index {
    width: 100%;
    margin: auto;

    /*导航 */
    .van-nav-bar__title {
        margin-left: 10px;
        font-size: 1rem;
    }

    /*搜索框 */
    .box-input {
        width: 96%;
        margin: auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-sizing: border-box;
    }

    /*轮播 */
    .my-swipe {
        .van-swipe-item {
            color: #fff;
            font-size: 20px;
            height: 150px;
            line-height: 150px;
            text-align: center;
            background-color: #39a9ed;

            img {
                width: 100%;
                height: 100%;
            }
        }
    }

    /*宫格 */

    .van-grid-item__content {
        padding: 10px;

        .van-image {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            overflow: hidden;
            margin-bottom: 5px;
        }
    }

    /*官方动态 */
    .dynamics {
        width: 96%;
        margin: auto;
        padding: 2px;
        display: flex;
        box-sizing: border-box;
        justify-content: space-between;
        background: repeating-linear-gradient(to left, #fff7f5, #fff7f5);
        align-items: center;
        border-radius: 5px;

        .dynamics-left {
            text-align: center;
            width: 15%;
            font-size: 20px;
            color: #fd6a66;
            font-weight: bold;
        }

        .dynamics-center {
            height: 30px;
            border-right: 1px solid #a8a4a2;
        }

        .dynamics-right {
            width: 80%;
            padding: 2%;

            .right-all {
                width: 100%;
                display: flex;
                justify-content: left;
                font-size: 13px;
                margin: 2px;

                .right-one {
                    width: 15%;
                    border-radius: 5px;
                    text-align: center;
                    border: 1px solid #fd6a66;
                    color: #fd6a66;
                    background-color: #fff;
                }

                .right-two {
                    width: 100%;
                }
            }

        }
    }

    /*推荐 */
    .recommend {
        width: 96%;
        margin: auto;
        margin-top: 10px;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;

        .recommed-left {
            padding: 5px;
            box-sizing: border-box;
            border-radius: 10px;
            width: 48%;
            background-color: #fba1a1;
            display: flex;
            justify-content: space-between;

            .left-one {

                width: 48%;
                color: #fff;

                .left-one1 {
                    width: 100%;
                    margin-top: 10px;
                }
            }

            .left-two {
                width: 48%;

                img {
                    width: 100%;
                    height: 100px;
                }
            }

        }


    }

    /*热销 */
    .sellwell {
        width: 96%;
        margin: auto;
        margin-top: 10px;
        border-radius: 10px;
        box-shadow: 5px 5px #f6f6f6;
        box-sizing: border-box;
        background: repeating-linear-gradient(to bottom, #fbdee3, #ffffff);
        display: flex;
        justify-content: space-between;

        .sellwell-all {
            width: 30%;
            padding: 5px;

            .one {
                width: 100%;
                display: flex;
                align-items: center;
                text-align: center;

                .colr {
                    font-size: 20px;
                }

                img {
                    margin-left: 10px;
                    width: 25px;
                    height: 25px;
                }
            }

            .two {
                width: 80%;
                margin: auto;
                background-color: #fd6965;
                color: #fff;
                border-radius: 10px;
                margin-top: 5px;
                padding: 2px;
                text-align: center;
            }

            .three {
                margin-top: 10px;
                text-align: center;

                img {
                    width: 80%;
                    height: 100px;
                }
            }
        }
    }

    /*送花 */
    .sendflowers {
        width: 96%;
        margin: auto;
        display: flex;
        margin-top: 20px;
        justify-content: space-between;
        box-sizing: border-box;

        .left {
            background: repeating-linear-gradient(to bottom, #fbdee3, #ffffff);
            padding: 2px;
            border-radius: 5px;
            width: 48%;
            text-align: center;

            div:nth-child(1) {
                width: 90%;
                margin: auto;
                text-align: left;
                color: #f46382;
                font-weight: bold;
                font-size: 18px;
            }

            div:nth-child(2) {
                width: 90%;
                margin: auto;
                text-align: left;
                font-size: 14px;
                color: #f46382;
                font-weight: bold;
            }

            div:nth-child(3) {
                font-size: 14px;
                width: 90%;
                margin: auto;
                text-align: left;
                color: #f46382;
                align-items: center;
            }

            img {
                padding: 2px;
                width: 80%;
                margin: auto;

            }
        }

        .right {
            width: 48%;
            box-sizing: border-box;

            .right-top {
                margin-bottom: 10px;
                background: repeating-linear-gradient(to bottom, #f9ede1, #f6f6f6);
                box-sizing: border-box;
                border-radius: 5px;
                overflow: hidden;
                width: 100%;
                height: 48%;
                display: flex;
                justify-content: space-between;

                .top-left {
                    width: 58%;
                    padding: 2px;

                    div:nth-child(1) {
                        width: 90%;
                        margin: auto;
                        text-align: left;
                        color: #fea85e;
                        font-weight: bold;
                        font-size: 16px;
                    }

                    div:nth-child(2) {
                        width: 90%;
                        margin: auto;
                        text-align: left;
                        color: #fea85e;
                        font-weight: bold;
                        font-size: 12px;
                    }

                    div:nth-child(3) {
                        width: 90%;
                        margin: auto;
                        text-align: left;
                        color: #fea85e;
                        align-items: center;
                        font-size: 11px;
                    }
                }

                .top-right {
                    width: 40%;

                    img {
                        margin-top: 10px;
                        width: 100%;

                    }
                }
            }
        }
    }

    /*爆款 */
    .explosion {
        width: 96%;
        margin: auto;
        margin-top: 15px;
        box-sizing: border-box;

        .explosion-top {
            display: flex;
            justify-content: space-between;

            .left {
                font-size: 20px;
                font-weight: bold;
            }

            .right {
                font-size: 16px;
                color: #bfbfbf;
            }
        }

        .explosion-bottom {
            width: 100%;
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;

            .left {
                box-sizing: border-box;
                padding: 2px;
                width: 48%;
                text-align: center;

                img {
                    width: 100%;
                    border-radius: 5px;
                }

                .one {
                    text-align: left;
                    font-size: 20px;
                    font-weight: bold;
                }

                .two {
                    margin-top: 5px;
                    display: flex;
                    justify-content: space-between;
                    color: #bebebe;
                    font-size: 14px;
                    align-items: center;
                }

                .three {
                    margin-top: 10px;
                    width: 100%;
                    margin-top: 5px;
                    display: flex;
                    justify-content: space-between;
                    color: #bebebe;
                    align-items: center;

                    img {
                        width: 15px;
                        height: 10px;
                    }

                    div:nth-child(1) {
                        width: 58%;
                    }

                    div:nth-child(3) {
                        font-size: 10px;
                        width: 30%;
                    }
                }

                .four {
                    margin-top: 10px;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;

                    div:nth-child(1) {
                        color: #fd4837;
                    }

                    div:nth-child(2) {
                        padding: 2%;
                        border-radius: 20px;
                        background-color: #f84c55;
                        width: 40%;
                        color: #fff;
                    }
                }
            }


        }
    }
}
</style>
